import { createSlice } from "@reduxjs/toolkit";

const chengk = createSlice({
  name: "chengk",
  initialState: [
    {
      id: 1,
      name: "张三",
      phone: "121212122",
      card: "121212121212",
      status: true,
    },
    {
      id: 2,
      name: "李四",
      phone: "121212122",
      card: "121212121212",
      status: false,
    },
    {
      id: 3,
      name: "王五",
      phone: "121212122",
      card: "121212121212",
      status: true,
    },
    {
      id: 4,
      name: "赵六",
      phone: "121212122",
      card: "121212121212",
      status: true,
    },
  ],
  reducers: {
    list1(state, { payload }) {
      state[payload.index].status = payload.checked;
    },
  },
});

export const { list1 } = chengk.actions;
export default chengk.reducer;
